<!-- include tpl=head_lay nopadding=true -->
<script type="text/javascript" src="{func add_js fields.js}"></script>
<script type="text/javascript">
function save()
{
	var obj = art.dialog.opener;
	$("#ext_add").ajaxSubmit({
		'url':get_url('ext','save'),
		'type':'post',
		'dataType':'json',
		'success':function(rs){
			if(rs.status){
				$.dialog.alert('添加成功',function(){
					obj.$.dialog.close();
					obj.$.phpok.reload();
				},'succeed');
				return true;
			}
			$.dialog.alert(rs.info);
			return false;
		}
	});
}
</script>
<form method="post" class="layui-form" id="ext_add">
<input type="hidden" name="id" id="id" value="{$id}" />
<div class="layui-card">
	<div class="layui-card-body">
		<div class="layui-form-item">
			<label class="layui-form-label">
				{lang字段名称：}
			</label>
			<div class="layui-input-block">
				<input type="text" name="title" id="title" value="{$rs.title}" class="layui-input" placeholder="{lang设置一个名称，该名称在表单的头部信息显示}" />
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">
				{lang字段备注：}
			</label>
			<div class="layui-input-block">
				<input type="text" name="note" id="note" value="{$rs.note}" class="layui-input" placeholder="{lang仅限后台管理使用，用于查看这个字段主要做什么}" />
			</div>
		</div>
		
		<div class="layui-form-item">
			<label class="layui-form-label">
				{lang字段标识：}
			</label>
			<div class="layui-input-block gray" style="line-height:38px;">{lang要求}<span class="darkblue">{lang字母、数字及下划线，且必须以字母开头}</span></div>
			<div class="layui-input-block">
				<div class="layui-input-inline auto">
					<input type="text" id="identifier" name="identifier" class="layui-input" value="{$rs.identifier}" />
				</div>
				<div class="layui-input-inline auto gray lh38" data-id="identifier">
					<input type="button" value="{lang随机生成}" onclick="$('#identifier').val($.phpok.rand(10,'letter'))" class="layui-btn layui-btn-sm" />
				</div>
			</div>
			
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">
				{lang表单类型：}
			</label>
			<div class="layui-input-block">
				<select id="form_type" name="form_type" lay-filter="form_type">
					<option value="">{lang请选择表单…}</option>
					<!-- loop from=$form_list key=$key value=$value id=$tmpid -->
					<option value="{$key}"{if $key == $rs.form_type} selected{/if}>{$value.title}<!-- if $value.note -->（{$value.note}）<!-- /if --></option>
					<!-- /loop -->
				</select>
			</div>
		</div>
		<div id="form_type_ext" style="display:none"></div>
		<div class="layui-form-item">
			<label class="layui-form-label">
				{lang样式：}
			</label>
			<div class="layui-input-block gray" style="line-height:38px;">{lang不能超过250个字符，不熟悉CSS，请查相关手册，不支持引号}</div>
			<div class="layui-input-block">
				<input type="text" id="form_style" name="form_style" class="layui-input" value="{$rs.form_style}" />
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">
				{lang默认值：}
			</label>
			<div class="layui-input-block gray" style="line-height:38px;">{lang设置表单默认值，如果表单中有多个值，请用英文逗号隔开}</div>
			<div class="layui-input-block">
				<input type="text" id="content" name="content" class="layui-input" value="{$rs.content}" />
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">
				{lang格式化：}
			</label>
			<div class="layui-input-block">
				<select name="format" id="format">
					<!-- loop from=$format_list key=$key value=$value id=$tmpid -->
					<option value="{$key}"{if $rs.format == $key} selected{/if}>{$value.title}<!-- if $value.note -->（{$value.note}）<!-- /if --></option>
					<!-- /loop -->
				</select>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">
				{lang排序}：
			</label>
			<div class="layui-input-inline short">
				<input type="text" name="taxis" id="taxis" class="layui-input" value="{$rs.taxis ? $rs.taxis : 255}" />
			</div>
			<div class="layui-form-mid">
				{lang值越小越往前靠，可选范围：1-255}
			</div>
		</div>
	</div>
</div>



<script type="text/javascript">
$(document).ready(function(){
	layui.form.on('select(form_type)', function(data){
		_phpok_form_opt(data.value,'form_type_ext','{$id}')
	});
});
</script>


</form>
<!-- include tpl=foot_lay is_open=true -->
